package queue

type (
	produceOptionPriority   QueuePriority
	produceOptionProcessIn  int
	produceOptionTimeout    int
	produceOptionRetention  int
	produceOptionMaxRetries int

	consumeOptionConcurrency    int
	consumeOptionStrictPriority bool

	dispatchOptionPriority        QueuePriority
	dispatchOptionProcessIn       int
	dispatchOptionUseRawQueueName bool

	handleOptionStrictPriority bool
)

// # ProduceOption

type ProduceOption interface {
	Value() interface{}
	Key() string
}

func ProduceOptionProcessIn(seconds int) ProduceOption {
	return produceOptionProcessIn(seconds)
}
func (d produceOptionProcessIn) Value() interface{} { return d }
func (d produceOptionProcessIn) Key() string        { return "process_in" }

func ProduceOptionTimeout(seconds int) ProduceOption {
	return produceOptionTimeout(seconds)
}
func (d produceOptionTimeout) Value() interface{} { return d }
func (d produceOptionTimeout) Key() string        { return "timeout" }

func ProduceOptionRetention(seconds int) ProduceOption { // 消息保留时长
	return produceOptionRetention(seconds)
}
func (d produceOptionRetention) Value() interface{} { return d }
func (d produceOptionRetention) Key() string        { return "retention" }

func ProduceOptionPriority(priority QueuePriority) ProduceOption {
	return produceOptionPriority(priority)
}
func (d produceOptionPriority) Value() interface{} { return d }
func (d produceOptionPriority) Key() string        { return "priority" }

// ProduceOptionMaxRetries 最大重试次数
func ProduceOptionMaxRetries(maxRetries int) ProduceOption {
	return produceOptionMaxRetries(maxRetries)
}
func (d produceOptionMaxRetries) Value() interface{} { return d }
func (d produceOptionMaxRetries) Key() string        { return "max_retries" }

// # ConsumeOption

type ConsumeOption interface {
	Value() interface{}
	Key() string
}

func ConsumeOptionConcurrency(concurrency int) ConsumeOption {
	return consumeOptionConcurrency(concurrency)
}
func (d consumeOptionConcurrency) Value() interface{} { return d }
func (d consumeOptionConcurrency) Key() string        { return "concurrency" }

func ConsumeOptionStrictPriority(strictPriority bool) ConsumeOption {
	return consumeOptionStrictPriority(strictPriority)
}
func (d consumeOptionStrictPriority) Value() interface{} { return d }
func (d consumeOptionStrictPriority) Key() string        { return "strict_priority" }

// # DispatchOption

type DispatchOption interface {
	Value() interface{}
	Key() string
}

func DispatchOptionPriority(priority QueuePriority) DispatchOption {
	return dispatchOptionPriority(priority)
}
func (d dispatchOptionPriority) Value() interface{} { return d }
func (d dispatchOptionPriority) Key() string        { return "priority" }

func DispatchOptionProcessIn(seconds int) DispatchOption {
	return dispatchOptionProcessIn(seconds)
}
func (d dispatchOptionProcessIn) Value() interface{} { return d }
func (d dispatchOptionProcessIn) Key() string        { return "process_in" }

// # HandleOption

type HandleOption interface {
	Value() interface{}
	Key() string
}

func HandleOptionStrictPriority(strictPriority bool) HandleOption {
	return handleOptionStrictPriority(strictPriority)
}
func (d handleOptionStrictPriority) Value() interface{} { return d }
func (d handleOptionStrictPriority) Key() string        { return "strict_priority" }
